﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

namespace Microsoft.Samples.Office.UnifiedCommunications.Gadget
{
    public class StatusTexttoImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string statusText = value.ToString();

            switch (statusText)
            {
                case "Out to lunch":
                case "Be right back":
                case "Away":
                    return Application.Current.FindResource("presenceAway") as DrawingImage;
                case "Idle":
                    return Application.Current.FindResource("presenceIdleOnline") as DrawingImage;
                case "May be available":
                case "Available":
                    return Application.Current.FindResource("presenceOnline") as DrawingImage;
                case "Busy":
                case "In a meeting":
                case "In a conference":
                case "In a call":
                    return Application.Current.FindResource("presenceBusy") as DrawingImage;
                case "Allow Urgent Interruptions":
                case "Do not disturb":
                    return Application.Current.FindResource("presenceDnd") as DrawingImage;
                case "Unknown":
                case "Offline":
                    return Application.Current.FindResource("presenceOffline") as DrawingImage;
                case "Blocked":
                    return Application.Current.FindResource("presenceBlock") as DrawingImage;
                case "Custom":
                case "Out of the office":
                default:
                    return Application.Current.FindResource("presenceUnknown") as DrawingImage;
            };
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
